package com.parking.order.controller;


import com.parking.common.core.model.Result;
import com.parking.common.core.util.JwtUtil;
import com.parking.order.service.IRentersIncomeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 吴彦祖
 * @since 2023年11月28日
 */
@RestController
@Api(tags = "出租客日月收入统计")
@RequestMapping("/rentersIncome")
public class RentersIncomeController {
    /**
     * 出租客日月收入统计服务层
     * */
    @Autowired
    private IRentersIncomeService rentersIncomeService;
    /**
     * 出租客查询12月每日收入
     * 参数 出租客token authorization
     * 返回 List<Integer> 1-31日 收入 BigDecimal->int
     * */
    @ApiOperation("出租客查询12月每日收入")
    @GetMapping("/findDailyIncome.renters")
    public Result<List<Integer>> findDailyIncomeRenters(@RequestHeader String authorization) throws Exception {
        List<Integer> incomes = rentersIncomeService.findDailyIncomeRenters(JwtUtil.getRentersId(authorization));
        return Result.getListResult(Integer.class).setData(incomes).setMessage("出租客查询12月每日收入成功");
    }
}

